﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ManageFoodBeverage.aspx.cs" Inherits="LuxuryResort.WebSite.Members.FoodBeverageList" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h1>
        Foods Management
    </h1>
    <div style="text-align: right;" class="roomInformation">
        <asp:Button ID="btnAdd" runat="server" Text="Add New" CausesValidation="False" 
                    onclick="btnAdd_Click" />
    </div>
    <fieldset>
        <legend>Food/Beverage</legend>
        <asp:ListView ID="lvFood" runat="server" onitemcommand="lvFood_ItemCommand">
            <LayoutTemplate>
                <table class="roomList">
                    <tr>
                        <th style="width: 10%">
                            Item Name
                        </th>
                        <th>
                            Type
                        </th>
                        <th>
                            Price Unit
                        </th>
                        <th>
                            Edit
                        </th>
                    </tr>
                    <tr runat="server" id="itemPlaceholder">
                    </tr>
                </table>
            </LayoutTemplate>
            <ItemTemplate>
                <tr>
                    <td style="text-align: left; width: 10%;">
                        <asp:Label ID="lblItemName" runat="server" Text='<%#Eval("Name") %>' />
                        <asp:HiddenField ID="hidFid" runat="server" Value='<%#Eval("FID") %>' />                        
                    </td>
                    <td style="text-align: center">
                        <asp:Label ID="lblType" runat="server" Text='<%#Eval("Type") %>' />
                    </td>
                    <td style="text-align: center; width: 10%;">
                        <asp:Label ID="lblPrice" runat="server" Text='<%#Eval("PriceUnit") %>' />
                    </td>
                    <td style="text-align: center; width: 10%;">
                        <asp:LinkButton ID="lnkEdit" runat="server" Text="Edit" CommandName="UpdateFood" CausesValidation="False"></asp:LinkButton>
                        <asp:LinkButton ID="lnkDelete" runat="server" Text="Delete" CommandName="DeleteFood" CausesValidation="False"></asp:LinkButton>
                    </td>
                </tr>
            </ItemTemplate>
        </asp:ListView>
        <asp:DataPager ID="pgFoods" runat="server" PagedControlID="lvFood" PageSize="10"
                       OnPreRender="DataPagerFoods_PreRender">
            <Fields>
                <asp:NextPreviousPagerField ShowFirstPageButton="True" ShowNextPageButton="False" />
                <asp:NumericPagerField />
                <asp:NextPreviousPagerField ShowLastPageButton="True" ShowPreviousPageButton="False" />
            </Fields>
        </asp:DataPager>
    </fieldset>
    <span id="lblMessage" class="failureNotification"></span>
    <div runat="server" id="divFoodInformation" Visible="False">
        <fieldset>
            <legend>Food/Beverage information</legend>
            <table width="100%" class="roomInformation">
                <tr>
                    <td style="width: 20%">
                        Food Name
                    </td>
                    <td style="width: 40%">
                        <asp:TextBox ID="txtFoodName" runat="server" MaxLength="100"></asp:TextBox><br/>
                        <asp:RequiredFieldValidator ID="reqFoodName" runat="server" ControlToValidate="txtFoodName"
                                                    Display="Static" ErrorMessage="You must input Name" CssClass="failureNotification"></asp:RequiredFieldValidator>
                    </td>
                    <td>
                        Food Type
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlFoodTypes" runat="server">
                            <asp:ListItem Value="Food"> Food </asp:ListItem>
                            <asp:ListItem Value="Beverage"> Beverage </asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        Price
                    </td>
                    <td>
                        <asp:TextBox ID="txtPrice" runat="server" MaxLength="100"></asp:TextBox><br />
                        <asp:RequiredFieldValidator ID="reqPrice" runat="server" ControlToValidate="txtPrice"
                                                    Display="Static" ErrorMessage="You must input Price" CssClass="failureNotification"></asp:RequiredFieldValidator>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:Button ID="btnAddItem" runat="server" onclick="btnAddItem_Click" 
                                    Text="Add" Visible="False" />
                        <asp:Button ID="btnUpdate" runat="server" OnClick="btnUpdate_Click" Text="   Update   " Visible="False" />
                    </td>
                </tr>
            </table>
            <asp:HiddenField ID="hidFoodID" runat="server" />
        </fieldset>
    </div>
</asp:Content>